<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>内置对象</title>
  <script>
    /**
     * 1. Math对象
     */
    function fun1(){
      // 1. 返回圆周率
      const pi = Math.PI
      console.log("pi = ",pi)
      // 2. 返回绝对值
      const abs = Math.abs(-10)
      console.log("abs = ",abs)
      // 3. 返回一个数的n次幂
      const pow = Math.pow(2,3)
      console.log("pow = ",pow)
      // 4. 返回一个数的四舍五入的值
      const round = Math.round(3.556)
      console.log("round = ",round)
      // 5. 返回多个数中的最大值与最小值
      const max = Math.max(1,2,3,4)
      const min = Math.min(1,2,3,4)
      console.log("max = ",max,", min = ",min)
      // 6. 返回一个数的平方根
      const sqrt = Math.sqrt(10)
      console.log("sqrt = ",sqrt)
      // 7. 返回比指定数小的最大整数
      const floor = Math.floor(3.45)
      console.log("floor = ",floor)
      // 8. 返回比指定数大的最小整数
      const ceil = Math.ceil(3.45)
      console.log("ceil = ",ceil)
      // 9. 产生一个[0,1)随机小数
      const random = Math.random()
      console.log("random = ",random)
      // 10. 返回给定弧度的正弦值
      const sin = Math.sin(Math.PI/3)
      console.log("sin = ",sin)
    }
    fun1()
  </script>
</head>
<body>

</body>
</html>
